import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'
import { getInterviewTitle } from "../api/interview"
// 获取所有分类的面试题标题
export const getInterviewTitleAsync = createAsyncThunk(
  "user/updateUserInfoAsync",
  async (_, thunkApi) => {
    const { data } = await getInterviewTitle();
    thunkApi.dispatch(initviewList(data));
  }
);
export const userSlice = createSlice({
  name: 'interview',
  initialState: {
    interviewList: [], //面试题标题
  },
  reducers: {
    initviewList: (state, { payload }) => {
      state.interviewList = payload
    },

  }
})

export const { initviewList } = userSlice.actions

export default userSlice.reducer